package com.example.redis.conrtoller;

import com.example.redis.pojo.Student;
import com.example.redis.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName RedisController
 * @Desecription TODO 1.2新增
 * @Author gjy
 * @Date 2021/4/21 14:34
 * @Version 1.2
 **/

@RestController
@RequestMapping("/student")
public class RedisController {

    @Autowired
    private StudentService studentService;

    @GetMapping("/get")
    public Student get(@RequestParam("id") int id) {
        return studentService.getOne(id);
    }

    @PostMapping("/UpdateOne")
    public void updateOne(@RequestBody Student student) {
        studentService.updateStu(student);
        System.out.println("执行成功");
    }
}
